<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul id="list">
        <li>li1</li>
        <li>li2</li>
        <li id="li3">li3</li>
        <li>li4</li>
    </ul>
    <script>
        const list = document.getElementById('list');

        list.insertAdjacentHTML('afterbegin', '<li>new li</li>');
        list.insertAdjacentHTML('beforeend', '<li>new li</li>');

        list.insertAdjacentHTML('beforebegin', '<p>hello tag p</p>');
        list.insertAdjacentHTML('afterend', '<p>hello tag p</p>');




    </script>
</body>

</html>